package com.huli.controller;

import com.huli.domain.OwnerVip;
import com.huli.domain.UserVip;
import com.huli.service.MemberService;
import com.huli.service.OwnerVipService;
import com.huli.service.impl.MemberServiceImpl;
import com.huli.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(tags = "会员服务")
@RestController
@RequestMapping("/userVip")

public class MemberController {

    @Autowired
    MemberService memberService;
    @Autowired
    OwnerVipService ownerVipService;

    //通过用户会员id查询其会员信息
    @ApiOperation("通过用户会员id查询其会员信息")
    @ApiImplicitParam(name = "userVipId",value = "用户会员id" )
    @GetMapping("/selectUserVipById")
    public Result selectUserVipById(int userVipId){
        UserVip userVip = memberService.selectUserVipById(userVipId);
        return Result.successResult(userVip);
    }

    //查询用户会员表信息
    @ApiOperation("查询用户会员表信息")
    @GetMapping("/selectAllUserVip")
    public Result selectAllUserVip(){
        List<UserVip> userVips = memberService.selectAllUserVip();
        return Result.successResult(userVips);
    }

    @ApiOperation("查询位主会员表信息")
    @GetMapping("selectAllOwnerVip")
    public Result selectAllOwnerVip(){
        List<OwnerVip> ownerVips = ownerVipService.selectAllOwnerVip();
        return Result.successResult(ownerVips);
    }
}
